<extend name="./Application/Common/View/block/base.php" />
<block name="header">
    <include file="./Application/Admin/View/block/easyui_header.php" />
    <link href="/extend/umeditor/themes/default/css/umeditor.min.css" type="text/css" rel="stylesheet">
    <link href="__PUBLIC__/css/Content/show.css" rel="stylesheet" type="text/css" />
</block>
<block name="bdoy">
    <body>
        <form action="" method="post" onsubmit="return $(this).form('validate');">
            <input type="hidden" name="id" value="{$item['id']}"/>
            <table cellspacing="0" width="100%" class="">
                <tr>
                    <td class="label"><strong>{:LANG('parent')}: </strong></td>
                    <td class="form-line">
                        <select class="easyui-combobox nav-select" name="parent_id"
                                data-options="prompt:'请输入英文名称',required:true">
                            <option></option>

                            <if condition="0 eq $item['parent_id']">
                                <option value="0" selected="selected">作为顶级菜单</option>
                            </if>
                            <volist name="parents" id="parent">
                                <if condition="$parent['id'] eq $item['parent_id']">
                                    <option value="{$parent['id']}" selected="selected">{$parent['name']}</option>
                                    <else />
                                    <option value="{$parent['id']}">{$parent['name']}</option>
                                </if>
                            </volist>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td class="label"><strong>{:LANG('eng_name')}: </strong></td>
                    <td class="form-line">
                        <input value="{$item['name']}" class="easyui-textbox easyui-validatebox input-text" name="name" id="name" size="50" style="height: 24px;line-height: 24px;"
                               data-options="prompt:'请输入英文名称',required:true,validType:'length[2,50]'">
                    </td>
                </tr>
                <tr>
                    <td class="label"><strong>{:LANG('nav_name')}: </strong></td>
                    <td class="form-line">
                        <input value="{$item['title']}" class="easyui-textbox easyui-validatebox input-text" name="title" id="title" size="50" style="height: 24px;line-height: 24px;"
                               data-options="prompt:'请输入中文名称',required:true,validType:'length[2,50]'">
                    </td>
                </tr>
                <tr>
                    <td class="label"><strong>{:LANG('front_url')}: </strong></td>
                    <td class="form-line">
                        <input value="{$item['url']}" class="textbox input-text url-text" name="url" id="url" style="height: 24px;line-height: 24px;"
                               placeholder="请输入链接地址">
                    </td>
                </tr>
                <tr>
                    <td class="label"><strong>{:LANG('admin_url')}: </strong></td>
                    <td class="form-line">
                        <input value="{$item['admin_url']}" class="textbox input-text url-text" name="admin_url" id="admin_url" style="height: 24px;line-height: 24px;"
                               placeholder="请输入链接地址">
                    </td>
                </tr>
                <tr>
                    <td class="label"><label for="istofront"><strong>{:LANG('is_show')}: </strong></label></td>
                    <td class="form-line">
                        <input name="istofront" id="istofront" type="checkbox" value="1">
                    </td>
                </tr>
                <tr>
                    <td class="label"><label for="contentable"><strong>{:LANG('is_singel_page')}: </strong></label></td>
                    <td class="form-line">
                        <input name="contentable" id="contentable" type="checkbox" value="1">
                    </td>
                </tr>
                <tr>
                    <td class="label"><strong>{:LANG('sort')}: </strong></td>
                    <td class="form-line">
                        <input  value="{$item['sort']}" class="easyui-textbox easyui-validatebox input-text" name="sort" id="sort" style="height: 24px;line-height: 24px;"
                               data-options="prompt:'请输入序号'">
                    </td>
                </tr>

                <tr>
                    <td class="label"></td>
                    <td class="form-line">
                        <input type="submit" class="submit-button bule-button" value="{:LANG('save')}">
                        <input type="button" onclick="close_dialog()" class="submit-button" value="{:LANG('cancel')}">
                    </td>
                </tr>
            </table>
        </form>
        <div id="p" class="easyui-panel" title="{:LANG('url_tip')}" style="width:100%;height:250px;padding:10px;">
            <p>--如果开启“作为独立内容”，则系统将为您自动生成链接</p>
            <p>--如果需要向“招商引资->招商信息”这样的大类来进行细分子类，并有文章对应的子类“招商信息”，则后台链接地址为：/Admin/Typearticle/index?parentid=招商信息菜单ID</p>
            <p>前台链接为：/Home/Typearticle/index?parentid=招商信息菜单ID</p>
            <p>--如果需要绑定的是独立页面，请关闭“作为独立内容”，后台链接不用填写</p>
            <p>前台链接为：/Home/Singlefile/index?filename=文件名&&parentid=本菜单ID，且必须保证/Application/Home/View/Singlefile文件夹中有对应“文件名”的文件</p>
            <p>如果绑定链接为其他网站的链接，则直接填写即可，并确保“作为独立内容”关闭</p>
        </div>
    </body>
</block>
<block name="footExtendJs">
    <script>
        var is_show = {$item['istofront']};
        var is_content = {$item['contentable']};
        setchecked(is_show, is_content);
        $("#contentable").change(function() {

            if($(this).prop('checked') == true){
                setSinglePageUrl(true);
            }else{
                setSinglePageUrl(false);
            }
        });

        function setchecked(is_show, is_content){
            if(is_show == 1){
                $('#istofront').prop('checked', true);
            }
            if(is_content == 1){
                $('#contentable').prop('checked', true);
            }
        }

        function setSinglePageUrl(is){
            //前台链接
            var front_url = "/Home/Singlepage/Index?parent_id={$item['id']}";
            //后台链接
            var admin_url = "/Content/AdminSingelpage/edit?pid={$item['id']}";
            if(is){
                console.log(front_url);
                $("#url").val(front_url);
                $("#url").attr("readonly", "readonly");
                $("#url").attr("background", "#666");
                $("#admin_url").val(admin_url);
                $("#admin_url").attr("readonly", "readonly");
                $("#admin_url").attr("background", "#666");

            }else{
                $("#url").removeAttr("readonly");
                $("#admin_url").removeAttr("readonly");
                $("#url").removeAttr("background");;
                $("#admin_url").removeAttr("background");;
                $("#url").val("");
                $("#admin_url").val("");
            }
        }
    </script>

</block>
